﻿<cfsilent>
	<cfscript>
	
		event.setArg("pageTitle", "教学运行基础数据 - 培养方案修订 - 调整方向课程");
		
		sql = "SELECT 
					sbj_id, sbj_name, schooling_length 
				FROM 
					t_subject 
				WHERE 
					sbj_id = :subjectId  " ;
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="subjectId", value=event.getArg("SubID"), cfsqltype="cf_sql_varchar" );
		rs_subjectEntity = queryObj.execute( sql=sql ).getResult() ;

		sql = "SELECT 
					t_schema.shm_id, t_course.course_name, t_course.course_credit, 
					t_schema.cna_id, t_schema.prop_id, t_schema.term_index, t_schema.sbj_id 
				FROM 
					t_schema 
					INNER JOIN t_course ON t_course.cid = t_schema.cid 
				WHERE 
					shm_id = :shmId " ;
		queryObj = new query( datasource=application.dnsSlave ) ;
		queryObj.addParam( name="shmId", value=event.getArg("ID"), cfsqltype="cf_sql_varchar" );
		rs_schemaEntity = queryObj.execute( sql=sql ).getResult() ;
		
		sql = "SELECT 
					sbj_id, sbj_name, sbj_direction 
				FROM 
					t_subject 
				WHERE 
					sbj_id LIKE :subjectDirs ";
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="subjectDirs", value=event.getArg("SubID")&"_", cfsqltype="cf_sql_varchar" );
		rs_subjectDirs = queryObj.execute( sql=sql ).getResult();
	
		mathAdvice = getProperty("serviceFactory").getBean("senateMathAdvice");


		targetArgs = structNew();
		structInsert(targetArgs, "SubID", event.getArg("SubID"), true);
		structInsert(targetArgs, "Edition", event.getArg("Edition"), true);
		structInsert(targetArgs, "Schema", event.getArg("Schema"), true);

		passArgs = structNew();

		currentTab = event.getArg("TabID", "labCourse");

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('programSchema')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">培养方案</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 edit"></i>培养方案修订 - <cfoutput>#rs_subjectEntity.sbj_name#</cfoutput>专业(<cfoutput>#event.getArg("Edition")#</cfoutput>)版
				</h2>
			</div>
		</div>
	</div>
</div>

<!--- 加载导航菜单 --->
<!-- stepMenu-->
<cfoutput>#event.getArg("stepMenu")#</cfoutput>
<!--/stepMenu-->

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab2">
					<div class="tabLables">
						<span <cfif currentTab eq "labCourse">class="active"</cfif> id="labCourse" tabTarget="Course">调整课程开设信息</span>
						<cfif rs_subjectDirs.recordCount>
							<span <cfif currentTab eq "labDirection">class="active"</cfif> id="labCourse" tabTarget="Direction">设置上课专业方向</span>
						</cfif>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
					
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
					
				<div id="Course" class="tabContent">
						
					<form id="formEdit" onSubmit="javascript:return processVerfiyForm('formEdit');" class="formWrapper" method="post" action="<cfoutput>#buildURL('programSchemaWizardDirectionEntityUpdateDo')#</cfoutput>">
							
						<input type="hidden" name="SchemaID" value="<cfoutput>#rs_schemaEntity.shm_id#</cfoutput>" />
							
						<div class="label">
							<b>课程</b>
							<input name="CourseName" id="CourseName" type="text" class="typeTextReadOnly" verification="required" maxlength="30" value="<cfoutput>#rs_schemaEntity.course_name#</cfoutput>" />
						</div>
							
						<div class="label">
							<b>学分</b>
							<input name="Credit" id="Credit" type="text" class="typeTextReadOnly" verification="double" maxlength="4" value="<cfoutput>#numberFormat(rs_schemaEntity.course_credit, '_._')#</cfoutput>" />
						</div>
							
						<hr/>
						
						<div class="label">
							<b>课程类别</b>
							<select name="CourseNature">
								<option value="1" <cfif rs_schemaEntity.cna_id eq '1'>selected="selected"</cfif>>公共课</option>
								<option value="2" <cfif rs_schemaEntity.cna_id eq '2'>selected="selected"</cfif>>专业课</option>
								<option value="3" <cfif rs_schemaEntity.cna_id eq '3'>selected="selected"</cfif>>实验课</option>
								<option value="4" <cfif rs_schemaEntity.cna_id eq '4'>selected="selected"</cfif>>实践课</option>
								<option value="5" <cfif rs_schemaEntity.cna_id eq '5'>selected="selected"</cfif>>理论课</option>
							</select>
						</div>
							
						<div class="label">
							<b>是否必修</b>
							<input name="CourseProperty" type="radio" class="typeRadio" value="1" <cfif rs_schemaEntity.prop_id eq '1'>checked="checked"</cfif>/>必修
							<input name="CourseProperty" type="radio" class="typeRadio" value="2" <cfif rs_schemaEntity.prop_id eq '2'>checked="checked"</cfif>/>限选
						</div>
							
						<hr/>
							
						<div class="label">
							<b>计划开课学期</b>
							<table width="300">
								<cfloop from="1" to="#rs_subjectEntity.schooling_length#" index="termYear">
									<cfset term01 = numberFormat((2 * termYear - 1), '0_') />
									<cfset term02 = numberFormat((2 * termYear), '0_') />
									<cfset termS = 'S' & termYear />
									<tr>
										<td><input name="Term" type="radio" class="typeRadio" value="<cfoutput>#term01#</cfoutput>" <cfif rs_schemaEntity.term_index eq term01>checked="checked"</cfif>/><cfoutput>#mathAdvice.convertTermIdxToChinese(term01)#</cfoutput></td>
										<td><input name="Term" type="radio" class="typeRadio" value="<cfoutput>#term02#</cfoutput>" <cfif rs_schemaEntity.term_index eq term02>checked="checked"</cfif>/><cfoutput>#mathAdvice.convertTermIdxToChinese(term02)#</cfoutput></td>
										<td><cfif termYear lt 4><input name="Term" type="radio" class="typeRadio" value="<cfoutput>#termS#</cfoutput>" <cfif rs_schemaEntity.term_index eq termS>checked="checked"</cfif>/><cfoutput>#mathAdvice.convertTermIdxToChinese(termS)#</cfoutput></cfif></td>
									</tr>
								</cfloop>
							</table>
						</div>
							
						<hr/>
						
						<div class="lable">
							<input class="button" type="submit" value="更新" />
							<input class="button" type="reset" value="重设表格" />
						</div>
					</form>
						
					<div class="systemNotice">
						<h3><span class="img icon16x16 info"></span>删除课程</h3>
						<p>注意: 删除培养方案课程后, 会自动删除相应的班级执行教学计划. 请在下达教学任务前进行培养方案调整. </p>
				
						<form id="formRemove" class="formWrapper Transparent" method="post" action="<cfoutput>#buildURL('programSchemaWizardDirectionEntityRemoveDo')#</cfoutput>">
							<input type="hidden" name="SchemaID" value="<cfoutput>#rs_schemaEntity.shm_id#</cfoutput>" />
							<div class="lable"><input class="button2" type="submit" value="删除课程" /></div>
						</form>
					</div>
						
				</div>
					
				<cfif rs_subjectDirs.recordCount>
					
					<div id="Direction" class="tabContent">
						
						<form id="formDirection" onSubmit="javascript:return processVerfiyForm('formDirection');" class="formWrapper" method="post" action="<cfoutput>#buildURL('programSchemaWizardEntityChangeDirectionDo')#</cfoutput>">

							<input type="hidden" name="SchemaID" value="<cfoutput>#rs_schemaEntity.shm_id#</cfoutput>" />

							<div class="label">
								<b>课程</b>
								<input name="CourseName" id="CourseName" type="text" class="typeTextReadOnly" verification="required" maxlength="30" value="<cfoutput>#rs_schemaEntity.course_name#</cfoutput>" />
							</div>
							
							<div class="label">
								<b>学分</b>
								<input name="Credit" id="Credit" type="text" class="typeTextReadOnly" verification="double" maxlength="4" value="<cfoutput>#numberFormat(rs_schemaEntity.course_credit, '_._')#</cfoutput>" />
							</div>
							
							<hr/>
							
							<div class="label">
								<b>授课方向</b>
								<table width="300">
									<tr>
										<td><input name="SubjectDirection" type="radio" class="typeRadio" value="<cfoutput>#rs_subjectEntity.sbj_id#</cfoutput>" <cfif rs_subjectEntity.sbj_id eq rs_schemaEntity.sbj_id>checked="checked"</cfif>/>全部</td>
									</tr>
									<cfloop query="rs_subjectDirs">
										<tr>
											<td><input name="SubjectDirection" type="radio" class="typeRadio" value="<cfoutput>#rs_subjectDirs.sbj_id#</cfoutput>" <cfif rs_subjectDirs.sbj_id eq rs_schemaEntity.sbj_id>checked="checked"</cfif>/><cfoutput>#rs_subjectDirs.sbj_name#</cfoutput></td>
										</tr>
									</cfloop>
								</table>
							</div>

							<hr/>
						
							<div class="lable">
								<input class="button" type="submit" value="更改授课方向" />
								<input class="button" type="reset" value="重设表格" />
							</div>
								
						</form>
								
								
						
					</div>
				
				</cfif>
					
				
			</div>
		</li>
	</ul>
</div>


